import { Category } from '@libs/db/models/category.model';
import { Controller, Get } from '@nestjs/common';
import { ReturnModelType } from '@typegoose/typegoose';
import { InjectModel } from 'nestjs-typegoose';
import { ApiTags, ApiOperation } from '@nestjs/swagger';

@ApiTags('分类数据')
@Controller('categories')
export class CategoriesController {
  constructor(
    @InjectModel(Category)
    private readonly categoryModel: ReturnModelType<typeof Category>,
  ) {}

  @ApiOperation({ summary: '所有分类' })
  @Get()
  findAll() {
    return this.categoryModel.find();
  }
}
